package com.smarth.zhizulian.popupwindow;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.smarth.zhizulian.R;

/**
 * Created by 18865 on 2018/3/2.
 */

public class NewHongBaoDialog extends Dialog {
    private long mCoin;
    private View.OnClickListener onClickGetMoneyListener;

    public NewHongBaoDialog(@NonNull Context context, long coin) {
        super(context, R.style.MyDialog);
        mCoin = coin;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_newhongbao);
        TextView tv_money = findViewById(R.id.tv_money);
        tv_money.setText(mCoin + "金币");
        findViewById(R.id.v_getmoney).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onClickGetMoneyListener != null) {
                    onClickGetMoneyListener.onClick(v);
                }
                NewHongBaoDialog.this.dismiss();
            }
        });
        findViewById(R.id.iv_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                NewHongBaoDialog.this.dismiss();
            }
        });
    }

    public void setOnClickGetMoneyListener(View.OnClickListener onClickGetMoneyListener) {
        this.onClickGetMoneyListener = onClickGetMoneyListener;
    }
}
